package com.ctl.lib_common.widget

import androidx.paging.LoadState
import androidx.paging.LoadStateAdapter
import androidx.recyclerview.widget.RecyclerView

/**
 * created by : chentl
 * Date: 2020/08/06
 */
abstract class MyLoadStateAdapter<VH : RecyclerView.ViewHolder> : LoadStateAdapter<VH>() {

    override fun displayLoadStateAsItem(loadState: LoadState): Boolean {
        if (loadState.endOfPaginationReached) {
            return true
        }
        return loadState is LoadState.Loading || loadState is LoadState.Error
    }

}